<template>
  <view class="feedback">
    <view class="form">
      <view class="form-item l-border-bottom">
        <u--textarea
          placeholder="请输入反馈内容"
          border="none"
          v-model="form.content"
        ></u--textarea>
      </view>
      <view class="form-item">
        <view style="margin-bottom: 20rpx">上传图片</view>
        <Upload @input="(val) => (form.pic = val)" :maxCount="5"></Upload>
      </view>
    </view>
    <view class="submit" @click="submit">提交</view>
  </view>
</template>

<script>
import Upload from "@/components/Upload";
import { feedback } from "@/api";
export default {
  components: {
    Upload,
  },
  data() {
    return {
      form: {
        content: "",
        pic: "",
      },
    };
  },
  methods: {
    submit() {
      if (!this.form.content) {
        this.$toast("请输入反馈内容");
        return;
      }
      this.$modal("是否提交意见反馈？", () => {
        feedback(this.form).then(() => {
          this.$toast("提交成功");
          this.$route({
            type: "back",
            isDelay: true,
          });
        });
      });
    },
  },
};
</script>

<style lang="less" scoped>
.feedback {
  .form {
    margin-top: 28rpx;
    background: #fff;
  }
  .form-item {
    padding: 30rpx;
  }
  .tip {
    font-size: 28rpx;
    color: #138e57;
  }

  .submit {
    background: linear-gradient(83deg, #48b453 0%, #2c9f79 100%);
    border-radius: 200rpx;
    font-size: 32rpx;
    color: #ffffff;
    padding: 26rpx 0;
    text-align: center;
    margin: 80rpx 70rpx 0 70rpx;
  }
}
</style>
